package pl.us.ij.plugins.segmentation.infrastructure;

import ij.ImagePlus;
import ij.process.FloatProcessor;
import pl.us.ij.plugins.segmentation.Trace;

public class DefaultConvertStrategy extends ConvertStrategy {
    public DefaultConvertStrategy(ImagePlus imp, CommandParams params) {
        super(imp, params);
    }

    @Override
    public FloatProcessor getFloatProcessor(int channelNo) {
        FloatProcessor fp = this.inputImage.getProcessor().toFloat(channelNo, null);
        float[] pixels = (float[]) fp.getPixels();

        Trace.log("P: " + pixels[0] + ", " + pixels[1] + ", " + pixels[2] + ", " + pixels[3] + ", " + pixels[4]);

        return fp;
    }

    @Override
    public void setFloatProcessor(int channelNo, FloatProcessor fp) {

        float[] pixels = (float[]) fp.getPixels();

        Trace.log("P: " + pixels[0] + ", " + pixels[1] + ", " + pixels[2] + ", " + pixels[3] + ", " + pixels[4]);

        super.setFloatProcessor(channelNo, fp);

    }
}
